import request from '@/util/require'

/**
 * ************示例************
 * @param  {string }name  用户名
 * @param  { string}password  密码
 * @returns {token} 用户密钥
 */
export const loginApi = (data) => request.post('/user/login', data)


/**
 * ************示例************
 * @param  { stirng}userId  用户id
 * @returns {user} 用户信息
 * form-data
 */
export const getUserInfo = (data) => request.post('/user/getUserInfo', data)



/**
 * ************示例************
 * @param  {string }phone  手机号
 * @param  { string}password  密码
 * @param  { string}code    验证码
 * form-data
 */
export const register = (data) => request.post('/user/register', data)



export const send = (data) => request.get(`/msm/send/${data.phone}`)



/**
 * ************会员充值列表************
 * @returns {data} 列表
 */
export const listMemberTypeInfo = () => request.post('/user/listMemberTypeInfo')

/**
 * ************创建订单************
 * @param  {string }name  用户名
 * @param  { string}password  密码
 * @returns {token} 用户密钥
 */
export const createOrder = (data) => request.post('/order/createOrder', data)


/**
 * ************获取支付链接************
 * form-data
 * @param  {string }orderNo  订单id
 * @returns {url} 支付链接
 */
export const pay = (data) => request.post('/order/pay', data)
/**
 * ************查询订单状态************
 * form-data
 * @param  {string }orderId  订单id(orderNo)
 * @returns {orderState} 支付状态 -1已取消  0已过期   1待支付   2已支付
 */
export const findPayState = (data) => request.post('/order/findPayState', data)

/**
 * ************取消订单************
 * @param  {string }orderNo  订单id
 *
 */
export const cancelOrder = (data) => request.post('/order/cancelOrder', data)
